extends Sprite


var playerNearTest = false;
onready var labeltext = tr("test_text")

# Called when the node enters the scene tree for the first time.
func _ready():
	pass

func playerInteracts():
	if(Input.is_action_just_pressed("interact") 
		and playerNearTest 
		and GameManager.canInteract):
			Dialogue.queue_text(labeltext)
			GameManager.haltPlayerMotion()

func _on_StaticArea2D_area_entered(area:Area2D):
	if(area.is_in_group("Player")):
		playerNearTest = true
		GameManager.canInteract = true


func _on_StaticArea2D_area_exited(_area:Area2D):
	playerNearTest = false
	GameManager.canInteract = false

func _process(_delta):
	playerInteracts()
